﻿using SUNRPA.CONTROLS.IMPL.domain.attrubutes;
using SUNRPA.CONTROLS.IMPL.domain.flowRunningVar;
using SUNRPA.CONTROLS.IMPL.util;
using System.Collections.Concurrent;

namespace SUNRPA.CONTROLS.IMPL.domain.flowItemParam {
    [VarFieldName("OutVarName")]
    [Serializable]
    public class AddReduceTimeNParam:BaseParam {
        private string dateObj = "{Date}";
        //0增加时间，1减少时间
        private int adjustType = 0;
        private string adjustStep = "0";
        //0天，1月，2年
        private int timeUnit = 0;
        private string outVarName = "adjustDate";
        public string GetTranslateAdjustType() {
            switch(this.adjustType) {
                case 0:
                    return "增加";
                case 1:
                    return "减少";
                default : return "增加";
            }
        }
        public string GetTranslateTimeUnit() {
            switch(this.timeUnit) {
                case 0:
                    return "天";
                case 1:
                    return "月";
                case 2:
                    return "年";
                default : return "天";
            }
        }
        public string AdjustStep {
            get => adjustStep; 
            set { 
                adjustStep = value;
                NotifyPropertyChanged("AdjustStep");
            }  
        }
        public string DateObj {
            get => dateObj; 
            set { 
                dateObj = value;
                NotifyPropertyChanged("DateObj");
            }  
        }
        public int TimeUnit {
            get => timeUnit; 
            set { 
                timeUnit = value;
                NotifyPropertyChanged("TimeUnit");
            }  
        }
        public int AdjustType {
            get => adjustType; 
            set { 
                adjustType = value;
                NotifyPropertyChanged("AdjustType");
            }  
        }
        public string OutVarName {
            get => outVarName; 
            set { 
                outVarName = value;
                NotifyPropertyChanged("OutVarName");
            }  
        }
        public override void SetLatestVarName(ConcurrentDictionary<string, ConcurrentDictionary<string, RPAVariableDefineWrapper>> globleData) {
            this.outVarName = this.GetLatestName(this.outVarName, globleData);
        }
    }
}
